.class public Lrexsee/device/RexseeBattery;
.super Ljava/lang/Object;
.source "RexseeBattery.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field public static final EVENT_ONBATTERYCHANGED:Ljava/lang/String; = "onBatteryChanged"

.field private static final INTERFACE_NAME:Ljava/lang/String; = "Battery"


# instance fields
.field private mBatteryStatus:Ljava/lang/String;

.field private final mBroadcastReceiver:Landroid/content/BroadcastReceiver;

.field private final mBrowser:Lrexsee/core/browser/Browser;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 33
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 31
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/device/RexseeBattery;->mBatteryStatus:Ljava/lang/String;

    .line 38
    new-instance v0, Lrexsee/device/RexseeBattery$1;

    invoke-direct {v0, p0}, Lrexsee/device/RexseeBattery$1;-><init>(Lrexsee/device/RexseeBattery;)V

    iput-object v0, p0, Lrexsee/device/RexseeBattery;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    .line 34
    iput-object p1, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    .line 35
    iget-object v0, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onBatteryChanged"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 36
    return-void
.end method

.method static synthetic access$0(Lrexsee/device/RexseeBattery;Ljava/lang/String;)V
    .locals 0

    .prologue
    .line 31
    iput-object p1, p0, Lrexsee/device/RexseeBattery;->mBatteryStatus:Ljava/lang/String;

    return-void
.end method

.method static synthetic access$1(Lrexsee/device/RexseeBattery;)Ljava/lang/String;
    .locals 1

    .prologue
    .line 31
    iget-object v0, p0, Lrexsee/device/RexseeBattery;->mBatteryStatus:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/device/RexseeBattery;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 30
    iget-object v0, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method


# virtual methods
.method public disable()Z
    .locals 3

    .prologue
    .line 138
    :try_start_0
    iget-object v1, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lrexsee/device/RexseeBattery;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v1, v2}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 139
    const/4 v1, 0x1

    .line 142
    :goto_0
    return v1

    .line 140
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 141
    .local v0, "e":Ljava/lang/Exception;
    iget-object v1, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/device/RexseeBattery;->getInterfaceName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 142
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public enable()Z
    .locals 4

    .prologue
    .line 127
    :try_start_0
    new-instance v1, Landroid/content/IntentFilter;

    invoke-direct {v1}, Landroid/content/IntentFilter;-><init>()V

    .line 128
    .local v1, "filter":Landroid/content/IntentFilter;
    const-string v2, "android.intent.action.BATTERY_CHANGED"

    invoke-virtual {v1, v2}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 129
    iget-object v2, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v2}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v2

    iget-object v3, p0, Lrexsee/device/RexseeBattery;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v2, v3, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 130
    const/4 v2, 0x1

    .line 133
    .end local v1    # "filter":Landroid/content/IntentFilter;
    :goto_0
    return v2

    .line 131
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 132
    .local v0, "e":Ljava/lang/Exception;
    iget-object v2, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/device/RexseeBattery;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 133
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 21
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 17
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/device/RexseeBattery;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Battery"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getLastKnownInfo()Ljava/lang/String;
    .locals 1

    .prologue
    .line 146
    iget-object v0, p0, Lrexsee/device/RexseeBattery;->mBatteryStatus:Ljava/lang/String;

    if-nez v0, :cond_0

    const-string v0, "{}"

    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lrexsee/device/RexseeBattery;->mBatteryStatus:Ljava/lang/String;

    goto :goto_0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 25
    return-object p0
.end method
